package ar.edu.unq.wannaplay.ocupation;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import ar.edu.unq.wannaplay.utils.Pair;

public class CareerPlan implements Serializable {

    private static final long serialVersionUID = 1L;

    private String name;

    private Map<String, Pair<Integer, Integer>> salaries;

    public CareerPlan() {
        super();
    }

    public CareerPlan(final String name) {
        salaries = new HashMap<String, Pair<Integer, Integer>>();
        this.name = name;
    }

    public Map<String, Pair<Integer, Integer>> getSalaries() {
        return salaries;
    }

    public void setName(final String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public Pair<Integer, Integer> getSalaries(final String rankName) {
        return this.getSalaries().get(rankName);
    }

    public void addSalaries(final String rankName, final Pair<Integer, Integer> minMaxSalary) {
        this.getSalaries().put(rankName, minMaxSalary);
    }

    public int getMinSalary(final String rankName) {
        return this.getSalaries().get(rankName).getFirst();
    }

    public int getMaxSalary(final String rankName) {
        return this.getSalaries().get(rankName).getSecond();
    }

    public void addSalaries(final String rankName, final int base, final int max) {
        this.addSalaries(rankName, new Pair<Integer, Integer>(base, max));
    }

    public void removeRank(final String rank) {
        this.getSalaries().remove(rank);
    }

    public boolean hasRank(final String rank) {
        return this.getSalaries().containsKey(rank);
    }

    public void modifyRankName(final String oldRankName, final String newRankName) {
        Pair<Integer, Integer> minMaxSalary = salaries.remove(oldRankName);
        this.getSalaries().put(newRankName, minMaxSalary);
    }

    public void modifySalaries(final String rankName, final int base, final int max) {
        this.addSalaries(rankName, new Pair<Integer, Integer>(base, max));
    }

    public void setSalaries(final Map<String, Pair<Integer, Integer>> salaries) {
        this.salaries = salaries;
    }

}